import java.util.Scanner;

public class main {
    static int i=0;

    public static void main(String[] args) {
        String s;
        Scanner sc = new Scanner(System.in);
        s=sc.nextLine();
        char[] charArray=s.toCharArray();
        BiTreeNode root;
        root = createBiTree(charArray);
        preOerder(root);
    }
    public static BiTreeNode createBiTree(char[] charArray){
        BiTreeNode p=null;
        if (i<charArray.length){
            char elem=charArray[i];
            i++;
            if (elem!='#'){
                p=new BiTreeNode(elem,null,null);
                p.lchild=createBiTree(charArray);
                p.rchild=createBiTree(charArray);
            }
        }
        return p;
    }
    public static void preOerder(BiTreeNode root) {
        if (root==null)
            return;
        System.out.print(root.data);
        preOerder(root.lchild);
        preOerder(root.rchild);
    }
    public static class BiTreeNode {
        public Object data;
        public BiTreeNode lchild,rchild;

        public BiTreeNode() {
            this.data = null;
            this.lchild = null;
            this.rchild =null;
        }

        public BiTreeNode(Object data, BiTreeNode lchild, BiTreeNode rchild) {
            this.data = data;
            this.lchild = lchild;
            this.rchild = rchild;
        }
    }
}
